<HTML><HEAD><TITLE>shift(?X, ?C, ?Y)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(ic_symbolic)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>shift(?X, ?C, ?Y)</H1>
Y is C places after X in the domain order
<DL>
<DT><EM>X</EM></DT>
<DD>variable or domain value
</DD>
<DT><EM>C</EM></DT>
<DD>variable or integer
</DD>
<DT><EM>Y</EM></DT>
<DD>variable or domain value
</DD>
</DL>
<H2>Description</H2>

	Constrains X and Y such that Y is C positions after X in the domain
	order. C must be an integer or integer variable, and its range is
	-(S-1)..S-1 where S is the size of the symbolic domain.
	X and Y must be variables or values of the same domain. If one of
	them is domain-less, it will be given the same domain as the other.
	<P>
	The implementation achieves domain consistency iff C is instantiated
	at call time, otherwise only bounds consistency.

<H3>Modules</H3>
This predicate is sensitive to its module context (tool predicate, see @/2).
<H2>Examples</H2>
<PRE>
    ?- [X,Y] &amp;:: weekday, shift(X, 1, Y).
    X = X{[mo, tu, we, th, fr, sa]}
    Y = Y{[tu, we, th, fr, sa, su]}
    There is 1 delayed goal.
    Yes (0.00s cpu)

    [eclipse 4]: [X,Y]&amp;::weekday, shift(X,C,Y). 
    X = X{[mo, tu, we, th, fr, sa, su]}
    C = C{-6 .. 6}
    Y = Y{[mo, tu, we, th, fr, sa, su]}
    There are 3 delayed goals.
    Yes (0.00s cpu)

    ?- shift(we, 1, th).
    Yes (0.00s cpu)

    ?- shift(we, 2, fr).
    Yes (0.00s cpu)

    ?- shift(X, -1, th).
    X = fr
    Yes (0.00s cpu)

    ?- shift(tu, X, fr).
    X = 3
    Yes (0.00s cpu)

    ?- shift(tu,X,Y).
    X = X{-1 .. 5}
    Y = Y{[mo, tu, we, th, fr, sa, su]}
    Delayed goals: ...

    ?- shift(tu, 1, th).
    No (0.00s cpu)

    ?- shift(X, 1, Y).
    Arguments have no domains in shift(X, 1, Y) in module eclipse
    Abort

    ?- X &amp;:: weekday, shift(X, 1, red).
    Arguments have different domains (weekday,colour) in shift(X, 1, red) ...
    Abort
    </PRE>
<H2>See Also</H2>
<A HREF="../../lib/ic_symbolic/shift-4.html">shift / 4</A>, <A HREF="../../lib/ic_symbolic/YL-2.html">&< / 2</A>, <A HREF="../../lib/ic_symbolic/YG-2.html">&> / 2</A>, <A HREF="../../lib/ic_symbolic/YEL-2.html">&=< / 2</A>, <A HREF="../../lib/ic_symbolic/YGE-2.html">&>= / 2</A>, <A HREF="../../lib/ic_symbolic/YE-2.html">&= / 2</A>, <A HREF="../../lib/ic_symbolic/YRE-2.html">&\= / 2</A>, <A HREF="../../lib/ic_symbolic/rotate-3.html">rotate / 3</A>, <A HREF="../../kernel/termcomp/domain-1.html">domain / 1</A>
</BODY></HTML>
